package wangjg.security.resource.factory.db.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import wangjg.security.resource.factory.db.dao.RoleDAO;
import wangjg.security.resource.factory.db.entity.Role;

@Service
@Transactional
public class RoleService {

	public static final int GUEST = 0;
	public static final int REG_USER = 1;
	public static final int ORG_USER = 4;
	public static final int SYS_ADMIN = 6;
	
	@Autowired
	private RoleDAO dao;
	
	public List<Role> findAll(){
		return this.dao.findAll();
	}
	
	public Role getGuest(){
		return this.dao.findById(GUEST);
	}
	
	public Role getRegUser(){
		return this.dao.findById(REG_USER);
	}
	
	public Role getOrgUser(){
		return this.dao.findById(ORG_USER);
	}
	
	public Role getSysAdmin(){
		return this.dao.findById(SYS_ADMIN);
	}

}
